using System;
using System.Collections.Generic;
using System.Linq;

namespace Corelib.Entities
{
	[Table(Name = "dbo.Transactions")]
	public class Transaction
	{

		#region Private Data Members

		private int  _transactionID;
		private int  _transactionModeID;
		private int  _transactionModeNumber;
		private DateTime  _transactionModeDate;
		private double  _transactionAmount;
		private string  _transactionBankName;
		private DateTime  _transactionDate;
		private DateTime  _createDate;
		private DateTime  _modifyDate;

		#endregion

		#region Private "Static" Data Members

		private static readonly string[] _propertyNames = new string[] {
			"TransactionID",
			"TransactionModeID",
			"TransactionModeNumber",
			"TransactionModeDate",
			"TransactionAmount",
			"TransactionBankName",
			"TransactionDate",
			"CreateDate",
			"ModifyDate",
		};

		#endregion

		#region Constants

		public const int 
			FieldTransactionIDIdx = 0,
			FieldTransactionModeIDIdx = 1,
			FieldTransactionModeNumberIdx = 2,
			FieldTransactionModeDateIdx = 3,
			FieldTransactionAmountIdx = 4,
			FieldTransactionBankNameIdx = 5,
			FieldTransactionDateIdx = 6,
			FieldCreateDateIdx = 7,
			FieldModifyDateIdx = 8;

		#endregion

		#region Private instance data members

		private FieldInfo[] _fieldInfo = new FieldInfo[]{
			new FieldInfo(FieldTransactionIDIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionModeIDIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionModeNumberIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionModeDateIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionAmountIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionBankNameIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionDateIdx,FieldType.Primitive),
			new FieldInfo(FieldCreateDateIdx,FieldType.Primitive),
			new FieldInfo(FieldModifyDateIdx,FieldType.Primitive),
		};

		#endregion

		#region Public Properties

		[Column(DBType = "int not null")]
		public int TransactionID
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionIDIdx,  _transactionID); }
			set {  _transactionID = this.SetValueTypeHelper(_fieldInfo, FieldTransactionIDIdx,  _transactionID, value,  _transactionID == value); }
		}

		[Column(DBType = "int not null")]
		public int TransactionModeID
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionModeIDIdx,  _transactionModeID); }
			set {  _transactionModeID = this.SetValueTypeHelper(_fieldInfo, FieldTransactionModeIDIdx,  _transactionModeID, value,  _transactionModeID == value); }
		}

		[Column(DBType = "int null")]
		public int TransactionModeNumber
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionModeNumberIdx,  _transactionModeNumber); }
			set {  _transactionModeNumber = this.SetValueTypeHelper(_fieldInfo, FieldTransactionModeNumberIdx,  _transactionModeNumber, value,  _transactionModeNumber == value); }
		}

		[Column(DBType = "datetime null")]
		public DateTime TransactionModeDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionModeDateIdx,  _transactionModeDate); }
			set {  _transactionModeDate = this.SetValueTypeHelper(_fieldInfo, FieldTransactionModeDateIdx,  _transactionModeDate, value,  _transactionModeDate == value); }
		}

		[Column(DBType = "decimal(19,2) not null")]
		public double TransactionAmount
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionAmountIdx,  _transactionAmount); }
			set {  _transactionAmount = this.SetValueTypeHelper(_fieldInfo, FieldTransactionAmountIdx,  _transactionAmount, value,  _transactionAmount == value); }
		}

		[Column(DBType = "nvarchar(50) not null")]
		public string TransactionBankName
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionBankNameIdx,  _transactionBankName); }
			set {  _transactionBankName = this.SetValueTypeHelper(_fieldInfo, FieldTransactionBankNameIdx,  _transactionBankName, value,  _transactionBankName == value); }
		}

		[Column(DBType = "datetime not null")]
		public DateTime TransactionDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionDateIdx,  _transactionDate); }
			set {  _transactionDate = this.SetValueTypeHelper(_fieldInfo, FieldTransactionDateIdx,  _transactionDate, value,  _transactionDate == value); }
		}

		[Column(DBType = "datetime not null")]
		public DateTime CreateDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldCreateDateIdx,  _createDate); }
			set {  _createDate = this.SetValueTypeHelper(_fieldInfo, FieldCreateDateIdx,  _createDate, value,  _createDate == value); }
		}

		[Column(DBType = "datetime null")]
		public DateTime ModifyDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldModifyDateIdx,  _modifyDate); }
			set {  _modifyDate = this.SetValueTypeHelper(_fieldInfo, FieldModifyDateIdx,  _modifyDate, value,  _modifyDate == value); }
		}

		#endregion
	}
}
